#!/usr/bin/make -f 


#DEB_AUTO_UPDATE_DEBIAN_CONTROL := yes
ORIGDIR:=$(CURDIR)

include /usr/share/cdbs/1/rules/debhelper.mk
include /usr/share/cdbs/1/class/autotools.mk
include /usr/share/cdbs/1/rules/simple-patchsys.mk

LDFLAGS+="-L/usr/X11R6/lib"

STBUILD:=$(ORIGDIR)/stbuild
STSRC=$(ORIGDIR)/lib/StSoundLib_Release/StSoundLibrary
configure/libstsound-cpc-dev::
	mkdir -p $(STBUILD)
	cd $(STBUILD) && \
	$(DEB_CONFIGURE_SCRIPT_ENV) $(STSRC)/configure \
	$(subst --srcdir=.,,$(DEB_CONFIGURE_NORMAL_ARGS)) \
	$(DEB_CONFIGURE_EXTRA_FLAGS) $(DEB_CONFIGURE_USER_FLAGS)
	cd $(ORIGDIR)
build/libstsound-cpc-dev::
	make -C $(STBUILD)
install/libstsound-cpc-dev::
	make -C $(STBUILD) install DESTDIR=$(CURDIR)/debian/stsound


ZMACSRC:=$(ORIGDIR)/tools/ZMac
build/zmac::
	make -C $(ZMACSRC)
install/zmac::
	mkdir -p debian/zmac/usr/bin debian/zmac/usr/share/man/man1
	make -C $(ZMACSRC) install PREFIX=$(CURDIR)/debian/zmac/usr \
	MANDIR=$(CURDIR)/debian/zmac/usr/share/man/man1

clean::
	-rm -r -f $(STBUILD) debian/stsound
	-make -C $(ZMACSRC) clean

